import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); //数组数据个数
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = in.nextInt();
        }
        int target = in.nextInt();
        System.out.println(Arrays.toString(twoSum(num, target)));
    }

    public static int[] twoSum(int[] num,int target){
        Map<Integer,Integer> map = new HashMap<>();
        for (int i = 0;i< num.length;i++){
            if(map.containsKey(target-num[i])){
                return new int[]{map.get(target-num[i]),i};
            }
            map.put(num[i],i); //存入不合适的数组,以及下标
        }
        return new int[0];
    }
}
